﻿using System;
using System.IO;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace TM.QWeibo.Client.Helper
{
    public class DraftHelper
    {
        /// <summary>
        /// 保存Text
        /// </summary>
        /// <param name="content"></param>
        public void Save(string content) {
            Common.Isolated.Set(IsolatedHelper.TweetDraftKey,content);
        }
        /// <summary>
        /// 获取Text
        /// </summary>
        /// <returns></returns>
        public string Get() {
            var str=Common.Isolated.Get(IsolatedHelper.TweetDraftKey);
            if(str!=null){
                return str.ToString();
            }
            return "";
        }

        public SDK.Objects.UploadFile TweetImage
        {
            get
            {
                var img = Common.Isolated.Get(IsolatedHelper.TweetImageDraftKey); 
                if(img!=null)
                {
                    return (SDK.Objects.UploadFile) img;
                }
                return null;
            }
            set
            {
                Common.Isolated.Set(IsolatedHelper.TweetImageDraftKey, value);
            }
        }



        /// <summary>
        /// 清空草稿
        /// </summary>
        public void Clear() {
            Common.Isolated.Set(IsolatedHelper.TweetDraftKey, "");
            Common.Isolated.Set(IsolatedHelper.TweetImageDraftKey,null);
        }
    }
}
